package com.techgene.kanban.util;

public class AppConstants {

	
	/* admin authentication */
	public static final String LOGIN_PAGE = "login";
	public static final String ADMIN_PAGE = "admin";
	public static final String MANAGER_PAGE = "manager";
	public static final String DEVELOPER_PAGE = "developer";
	public static final String COMMON_ERROR_PAGE = "error";
	public static final String ADD_USER_PAGE = "addUser";
	public static final String UPDATE_DELETE_USER_PAGE = "updateDeleteUser";
	
	
	
	/* Admin module add project */
	
	
	public static final String PROJECT_FORM = "addProject";
	public static final String PROJECT_FORM_PAGE_REDIRECT = "project_redirect";
	
	/* session attributes */
	public static final String SESSION_ATTR_USER_NAME = "username";
	public static final String SESSION_ATTR_USER_ROLE = "user_role";

	/* status messages */
	public static final Object USER_LOGIN_FAILURE_MESSAGE = "Login credentials are not correct.Please login again!!";
	public static final String UPDATE_PROJECT_SUCCESS = "Project is updated successfully!!!";
	public static final String UPDATE_PROJECT_FAILURE = "Project updation failure!!!";
	public static final String ADD_PROJECT_SUCCESS = "The project details are stored successfully!!...";
	public static final String ADD_PROJECT_FAILURE = "Sorry, the project details are not stored please cross verify and enter the data once again!!";
	public static final String DELETE_PROJECT_SUCCESS = "Project Deleted successfully!!!";
	public static final String DELETE_PROJECT_FAILURE = "Sorry Project can not be Deleted!!!";
	public static final String USER_LOGOUT="You have logged out successfully.";
	public static final String ADD_USER_DATA_SUCCESS = "User Details added successfully.....!";
	public static final String ADD_USER_DATA_FAILURE = "User Data storage failed, please cross verify.....!";
	public static final String DELETE_USER_DETAILS_SUCCESS="User details deleted successfully";
	public static final String DELETE_USER_DETAILS_FAILURE="User details not deleted successfully";
	public static final String UPDATE_USER_DETAILS_FAILURE="User details not updated successfully";
	public static final String UPDATE_USER_DETAILS_SUCCESS="User details updated successfully";
	public static final String FECTH_USER_DETAILS_FAILURE="Fecthing User details failed";
	public static final String FECTH_USER_DETAILS_SUCCESS="successfully user details are fetched";
	
	
	/*update project*/
	
	public static final String SHOW_PROJECT_FORM = "showProjects";
	public static final String SHOW_PROJECT_DETAILS = "showProjectDetails";
	public static final String UPDATE_PROJECT = "updateProject";
	
	
	/*update user*/
	
	public static final String UPDATE_DELETE_USER_ERROR = "updateError";
	public static final String SHOW_USER_DETAILS = "updateDeleteUser";
	public static final String SHOW_USER_DETAILS_PAGE = "showUserDetails";

	
	
	/*list project*/
	
	public static final String SHOW_PROJECT_LIST="projectList";
	
	public static final String SHOW_PROJECTPAGE_ONDELETE="listProjects";

	/* sql querys */
	
	public static final String DEVELOPERS_LIST_SQL_QUERY = "select username from tbl_user where role='developer' or role='manager'";
	public static final String INSERT_PROJECT_DETAILSLIST_QUERY = "insert into tbl_project(project_name,project_description) values(?,?)";
	public static final String SELECT_PROJECT_ID_QUERY = "select project_id from tbl_project where project_name=?";
	public static final String SELECT_USER_ID_QUERY = "select user_id from tbl_user where username=?";
	public static final String INSERT_PROJECT_ID_TO_USER_ID_QUERY  = "insert into tbl_project_user values(?,?)";
	public static final String  DELETE_PROJECT_DETAILS_QUERY =  "delete from tbl_project where project_name=? ";
	public static final String INSERT_USER_DETAILS_QUERY = "Insert Into tbl_user(username,password,firstname,lastname,email,role) values(?,?,?,?,?,?)";
	public static final String SELECT_USER_DATA_QUERY = "Select username from tbl_user where firstname=?";
	public static final String SELECT_USER_DETAILS_QUERY="select username,firstname,lastname,email,role from tbl_user where username=?";
	public static final String DELETE_USER_DETAILS_QUERY="delete username,firstname,lastname,email,role from tbl_user where userName=?";
	
	
	/*
	 * delete project
	 */
	
	public static final String DISPLAY_PROJECTS = "displayProjects";
	public static final String DELETE_PROJECT = "deleteProject";
	
	
	/*
	 * project
	 */
	
	public static final String SHOW_USERS = "showUsers";
	public static final String SELECTED_USERS = "selectedUsers";
	public static final String SHOW_PROJECT="projectCreateDeleteUpdate";
	public static final String SHOW_PROJECT_REDIRECT="add";
	public static final String PROJECT_STATUSMSG="project successfully added";
	public static final String PROJECT_UPDATE="update";
	public static final String PROJECT_INSERT="insert";

	
	public enum ERROR {
		
		
		/* SERVICE */
		
		SERVICE_UNKNOWN_ERROR_UPDATE_PROJECT("S-123" , " cannot fetch the project names "),
		SERVICE_UNKNOWN_ERROR_LIST_PROJECT("S-456" , " cannot fetch the projects "),
		SERVICE_UNKNOWN_ERROR_DELETE_PROJECT("S-124" , " cannot delete project "),
		SERVICE_UNKNOWN_ERROR_VALIDATING_USER("S-200","Unknown error while validating user."),
		SERVICE_UNKNOWN_ERROR_ADD_PROJECT_DETAILS("A-100","project with this name already exists"),
        SERVICE_UNKNOWN_ERROR_ADD_USER_DETAILS("S-101","Unknown error while adding user details in database."),
        SERVICE_UNKNOWN_ERROR_UPDATE_DELETE_USER("S-202","Unknown error while updating user details in database."),
        
		/* DAO */
        
		DAO_UNKNOWN_ERROR_UPDATE_PROJECT("D-123" , " cannot fetch the project names "),
		DAO_UNKNOWN_ERROR_LIST_PROJECTS("D-456" , " cannot fetch the projects "),
		DAO_UNKNOWN_ERROR_VALIDATING_USER_DETAILS("D-100","Unknown error while validating user."),
		DAO_UNKNOWN_ERROR_ADD_PROJECT_DETAILS("A-100","project with this name already exists"),
		DAO_UNKNOWN_ERROR_DELETE_PROJECT("D-124" , " cannot delete project "),
		DAO_UNKNOWN_ERROR_ADD_USER_DETAILS("D-101","Unknown error while adding user details in database"),
		DAO_UNKNOWN_ERROR_UPDATE_DELETE_USER("D-202","cannot fetch the user names"),
		DAO_UNKNOWN_ERROR_UDPATE_DELETE_USER_DETAILS("D-202","cannot fetch the user names");
		
		public String code;
		public String msg;

		private ERROR(String code, String msg){
			this.code = code;
			this.msg = msg;
		}

		
	}
	
}
